home *** CD-ROM | disk | FTP | other *** search
/ The 640 MEG Shareware Studio 2 / The 640 Meg Shareware Studio CD-ROM Volume II (Data Express)(1993).ISO / tsr / repeat21.zip / REPEAT.DOC next >
Text File  |  1992-01-01  |  6KB  |  126 lines

  1.                                   REPEAT v2.1
  2.  
  3.  
  4.                             (c) 1992 by Ben Bernard
  5.  
  6.  
  7.  
  8.   The original idea of REPEAT was to allow you to apply a single command to
  9. multiple files.  This is needed for such commands as TYPE, which doesn't
  10. accept wildcards.  The solution was REPEAT TYPE # FOR *.TXT, where # was
  11. replaced by each successive file processed.
  12.   In using v 1.0 I found many other things which I thought should be added.
  13. You can see the result below.  Macro substitutions allow REPEAT to perform
  14. complex decisions based on variables related to the files being processed.
  15. New to version 2.1 is a wildcard matching routine which increases flexibility
  16. and a subdirectory recursion option, along with new macros and operators.
  17.   REPEAT is really a prototype, written with MS BASIC PDS 7.1, of a future
  18. program to be implemented in C when I get time to do so.  In the meantime,
  19. if I have left what you deem to be a useful feature out of REPEAT, drop me
  20. a line at the adresses listed at the end.
  21.  
  22. Legal stuff:  You use this program AT YOUR OWN RISK.  By using REPEAT, you
  23.  agree to absolve me of all claims for damage to any hardware, software, or
  24.  data which might be caused by this program.  You are hereby granted license to
  25.  use REPEAT for any use and any period of time, provided you do not modify the
  26.  code in any way.  This software may be distributed only in its original and
  27.  complete package, either in the original ZIP file or in an equivalent archive.
  28.  No fee can be charged for this software.  Disk duplicators and BBSs may,
  29.  however, charge a fee for their services.  While registration of this
  30.  software is not required, donations are appreciated.
  31.  
  32.  
  33. Usage:  REPEAT {command} FOR {filespec} IF {mask}
  34.   {command} will be executed once for each file in {filespec} for which
  35.   {mask} evaluates to true.
  36. {command} can contain any DOS command, plus the macros listed below.
  37. {filespec} can have full pathname and more.
  38. {mask} is optional and can contain any of the macros and operators below.
  39.  
  40. Macros:                     Operators:
  41.   $bd   space on drive d       {       }    =     ~
  42.   $d    file drive             greater less equal match
  43.   $e    extension              @  &   !
  44.   $f    filename               or and not
  45.   $n    basename
  46.   $p    file path
  47.   $s    file size
  48.   $t    file time
  49.   $y    file date
  50.   $[  ] left justify macros between [ ]
  51.   $r  ] right justify macros between r ]
  52.   $c  ] center macros between c ]
  53.   $()   pass as a literal the text between ()
  54.   $$    $
  55.   $,    <  \
  56.   $.    >   }these must be used to delay DOS redirection
  57.   $\    |  /
  58.  
  59.  
  60.  
  61. Some details:
  62. As I mentioned in the v2.0 docs, the directory is no longer preloaded.  This
  63.   was changed to allow traversing of directory trees.
  64. To use DOS redirection within {command} you must use the $, $. and $\ macros.
  65. You may now use the $() macro to pass macros literally, thus making it
  66.   possible to have REPEAT call itself recursively (probably not a good idea).
  67. Paths MUST end with '\' or '/'.  If you use D:\TEST as the filespec, REPEAT
  68.   will interpret D:\ as the path and TEST as the filespec.  If you use D:\TEST\
  69.   REPEAT will interpret D:\TEST\ as the path and *.* as the filespec.
  70. Multiple filespecs can be included in {filespec} by separating them with commas.
  71. Any path ending with '/' will cause REPEAT to recurse through all of its
  72.   subdirectories.  Paths ending in '\' will not be recursed.
  73. Filespec matching is done by REPEAT, and not by DOS.  This means, among other
  74.   things, that *P* will match only files with a P in their name, and not all
  75.   files.  It also means that a name is a name, and extensions, including the
  76.   '.' are treated as part of the name.  *.* is still a legitimate spec, but
  77.   will match the same as '*' because all files, extension or not, have the '.'.
  78. The disk space macro ($b) can accept the file drive macro ($d) as a parameter.
  79. The justification macros ($[ $r $c) pack as many spaces in as there are
  80.   characters between the macro and the terminator (exclusive).  The space
  81.   between can contain other macros, EXCEPT other justification macros.
  82. The equal operator '=' does a straight, no wildcards, comparison.  To use
  83.   wildcards, use the match operator '~'.
  84. The comparison operators treat dates specially so that they will be handled
  85.   properly.
  86. Pressing <ESC> during execution will result in REPEAT pausing when it regains
  87.   control, at which time you can decide to abort REPEAT or continue.
  88. Nothing in REPEAT is case sensitive.
  89.  
  90.  
  91. Examples:
  92.  
  93.  repeat echo $[$f          ]  $r$s       ]  $y  $t for *.* if $y=10-11-1990
  94.    Produces a DOS-like directory of all files with date 10-11-1990.
  95.  
  96.  repeat copy $f a:\ for *.* if $ba}$s
  97.    Copies files from current directory to drive a as long as there is space
  98.    for them.  Note that the disk space check is done dynamically, so that
  99.    as each file is copied onto drive a, the space available is adjusted
  100.    accordingly.
  101.  
  102.  repeat del $n.bas for *.obj
  103.    Deletes .BAS files with same basename as existing .OBJ files.
  104.  
  105.  repeat copy $d:$p$f c:\$d$f for d:/*.* e:/*.* f:/*.* if $bc>$s
  106.    Copies all files from d, e, and f to their respective directories
  107.    in c, as long as there is space on c for the file.  Note that the
  108.    directories must exist already.
  109.  
  110. History:
  111.  
  112. ?           1.0     Original version of REPEAT, never release to the public.
  113. ?           1.1     Added the except clause.
  114. 12-20-1991  2.0     Replaced EXCEPT with IF, added macros and operators.
  115. 01-01-1992  2.1     Added wildcard matching, recursion, and some macros.
  116.                     Changed to dynamic method of reading directories.
  117.  
  118.  
  119. Suggestions, donations, feedback, or just plain comments can be addressed to:
  120.  
  121. InterNet:    ben.bernard@channel1.com
  122. SnailMail:   Ben Bernard
  123.              POB 366
  124.              Celeste, TX 75423-0366
  125.  
  126.